package com.lcj.controller;

import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;

@Controller
@RequestMapping("/path")
public class PathController {
    @RequestMapping("/showLogin")
    public String showlogin()
    {
        System.out.println("PathController.showlogin");
        return "login";
    }

    @RequestMapping("/forwardLogin")
    public String forwardLogin()
    {
        System.out.println("PathController.forwardLogin");
        return "forward:showLogin";
    }

    @RequestMapping("/getpath/{id}/{name}")
    public String getpath(@PathVariable int id, @PathVariable String name)
    {
        System.out.println("PathController.getpath");
        System.out.println("id为："+id+",name为："+name);
        return "hello";
    }

    @RequestMapping(value = "/test6",method = RequestMethod.GET)
    public String test6(){
        System.out.println("PathController.test6");
        return "hello";
    }
    @PostMapping("/test6")
    public String test7(){
        System.out.println("PathController.test7");
        return "hello";
    }

    @RequestMapping(value = "/test8",params = {"id","name=mao","age!=123"})
    public String test8(){
        System.out.println("PathController.test8");
        return "hello";
    }

    @RequestMapping(value = "/test9",headers = {"Accept-Language=zh-CN,zh;q=0.9"})
    public String test9(Model model){
        System.out.println("PathController.test9");
        model.addAttribute("Msg","Accept-Language=zh-CN,zh;q=0.9");
        return "hello";
    }

}
